package com.code.softeem.zuoye.demo3;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/20 18:17
 * @description
 */
public class Test {
    public static void main(String[] args) {
        //      (1) 分别创建2个银行。
        Bank bank1 = new Bank();
        Bank bank2 = new Bank();
        //		(2) 在每个银行取得2张银行卡。
        BankCard b1card1 = bank1.createCard();

        BankCard b1card2 = bank1.createCard();

        BankCard b2card1 = bank2.createCard();

        BankCard b2card2 = bank2.createCard();
        //		(3) 每个卡分别存2次钱。
        bank1.deposit(b1card1,bank1);
        bank1.deposit(b1card1,bank1);

        bank1.deposit(b1card2,bank1);
        bank1.deposit(b1card2,bank1);

        bank2.deposit(b2card1,bank2);
        bank2.deposit(b2card1,bank2);

        bank2.deposit(b2card2,bank2);
        bank2.deposit(b2card2,bank2);
        //		(4) 每个卡分别取1次钱。
        bank1.withdraw(b1card1,bank1);
        bank1.withdraw(b1card2,bank1);
        bank2.withdraw(b2card1,bank2);
        bank2.withdraw(b2card2,bank2);
        //		(5) 显示每个卡的存款余额。
        System.out.println("卡1的余额："+b1card1.getBalance());
        System.out.println("卡2的余额："+b1card2.getBalance());
        System.out.println("卡3的余额："+b2card1.getBalance());
        System.out.println("卡4的余额："+b2card2.getBalance());
        //		(6) 显示所有卡的累计余额。
        System.out.println("所有卡的累计余额："+BankCard.getTotalBalance());
        //		(7) 显示每个银行的累计存款金额，累计取款金额。
        System.out.println("银行1的累计存款金额"+bank1.getTotalDeposit());
        System.out.println("银行1的累计取款金额"+bank1.getTotalWithdraw());
        System.out.println("银行2的累计存款金额"+bank2.getTotalDeposit());
        System.out.println("银行2的累计取款金额"+bank2.getTotalWithdraw());
        //		(8) 显示所有银行的累计存款金额，累计取款金额。
        System.out.println("所有银行的累计存款金额为:"+Bank.getAllTotalDeposit(bank1,bank2));
        System.out.println("所有银行的累计取款金额为:"+Bank.getAllTotalWithDraw(bank1,bank2));
    }
}
